/**
 * Copyright (c) 2018 qar All rights reserved.
 * <p>
 * https://www.qar.io
 * <p>
 * 版权所有，侵权必究！
 */

package io.qar.task;

import com.alibaba.fastjson.JSONObject;
import io.qar.commons.tools.utils.Result;
import io.qar.feign.FtpToFtpDataFeignClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * 定时同步航班信息表和关联业务表
 */
@Component("ftpToFtpTask")
public class FtpToFtpTask implements ITask {
    private Logger logger = LoggerFactory.getLogger(getClass());

    @Autowired
    private FtpToFtpDataFeignClient ftpToFtpDataFeignClient;


    @Override
    public void run(String params) {
    	// {"id", "1719299472002916354"}
        logger.info("ftpToFtpDataTask定时任务正在执行，参数为：{}", params);
        Map<String, String> map = JSONObject.parseObject(params, Map.class);
        String id = (String) map.get("id");
        Result result = ftpToFtpDataFeignClient.ftpToFtpDataTask(Long.valueOf(id));
        System.out.println(result);
    }
}